int* complex_equation(int* a, int& b, int c) 
{
	int d = 2 * *a + 3 * b * 2 * (3 + c);
	*a = 2 * *a;
	b = *a;
	b = sum(20, sum(*a, b + 10));
	int tmp1 = *a;
	tmp1 = 3;
	int tmp2 = 2 + ((3 + 4) * 5 / 7 + 8) * ((2 + 4) * 2) / (tmp1 * 2) - 20;
	*a = d + *a + b + tmp1 + tmp2;
	return a;
}

int& rt_ref1(int* a) 
{
	*a = 2 + *a;
	return *a;
}
int& rt_ref2(int& a) 
{
	a = 3 + a;
	return a;
}

int* rt_ptr1(int* a)
{
	*a = *a * 2;
	return a;
}
int* rt_ptr2(int& a) 
{
	a = a * 3;
	return &a;
}

void ptr_ref_change(int* a, int& b)
{
	*a = 30;
	b = 40;
}

int sum(int a, int b)
{
	int d = a + b;
	return d;
}

int mainFunc(int arg1, int arg2, int arg3)
{
		int a1 = arg1;
		int a2 = arg2;
		a1 = 20;
		int r1 = sum(arg1, a1);		//10 + 20 = 30
		ptr_ref_change(&a1, a2);
		int r2 = a1 + a2;
		a1 = 2;
		a2 = 3;
		int r3 = *rt_ptr1(&a1) * *rt_ptr2(a2) + rt_ref1(&arg2) + rt_ref2(arg3);
		// r3=46,a1=4,a2=9,arg2=4,arg3=6
		r3 = r3 + a1 + a2 + arg2 + arg3;
		arg1 = 3;   // a1=4
		arg2 = 4;
		arg3 = 5;
		//3,4,13
		int* r4 = complex_equation(&arg1, arg2, (arg3 + sum(1, rt_ref2(a1))));

		int result = r1 + r2 + r3 + *r4;
		return result;
}

//[(1,2,3),609]
//[(-1,-2,-1),591]
